/*
 * @Author       : Hejh(3010733382@qq.com)
 * @Version      : V1.0
 * @Date         : 2024-01-29 12:43:42
 * @Description  : 存储源相关接口
 */

import type {
  StorageOriginCreateReq,
  StorageOriginPageRes,
  StorageOriginReq,
  StorageOriginUpdateReq
} from '@/types/storageOrigin'
import request from '@/utils/request'

// 分页查询存储源接口
export const getStorageOriginByPage = (params?: StorageOriginReq) => {
  return request.get<StorageOriginPageRes>('/storageOrigin/list', { params })
}

// 添加存储源接口
export const createStorageOrigin = (data: StorageOriginCreateReq) => {
  return request.post('/storageOrigin/create', data)
}

// 更新存储源接口

export const updateStorageOrigin = (data: StorageOriginUpdateReq) => {
  return request.put('/storageOrigin/update', data)
}

// 设置默认存储源接口
export const setDefaultStorageOrigin = (storageOriginId: string) => {
  return request.put('/storageOrigin/setDefault', { storageOriginId })
}

// 存储源删除接口
export const delStorageOrigin = (
  storageOriginIds: string[],
  picCode?: string
) => {
  return request.delete('/storageOrigin/delete', {
    data: { storageOriginIds, picCode }
  })
}
